package com.tvein.sanguo.tool.controller
{
	//flash
	//pureMVC
	import org.puremvc.as3.multicore.interfaces.ICommand;
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.fabrication.patterns.command.SimpleFabricationCommand;
	//custom
	import com.tvein.sanguo.tool.view.ToolMediator;
	import com.tvein.sanguo.tool.model.SystemProxy;
//
	public class ToolInit extends SimpleFabricationCommand implements ICommand
	{
		private var systemData:SystemProxy;
		private var toolMediator:ToolMediator;
	
		override public function execute(notification:INotification) : void
		{
			systemData = facade.retrieveProxy(SystemProxy.NAME) as SystemProxy;
			toolMediator = facade.retrieveMediator(ToolMediator.NAME) as ToolMediator;
			
			switch(notification.getBody()[0])
			{
				case "srcServer":
					systemData.srcServer = notification.getBody()[1];
					break;
				case "effectVol":
					systemData.effectVol = notification.getBody()[1];
					
					var params:Object = new Object();
					params.Volume = systemData.effectVol;
					toolMediator.toolShell.console("setEffect", params);
					break;
				case "show":
					toolMediator.tool.visible = notification.getBody()[1];
					break;
			}
		}
	}
}